package com.project.bohang.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bohang.common.model.Response;
import com.project.bohang.entity.House;
import com.project.bohang.mapper.HouseMapper;
import com.project.bohang.pojo.dto.HouseDto;
import com.project.bohang.pojo.vo.HouseVo;
import com.project.bohang.service.HouseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author bohang
 * @since 2022-03-26
 */
@Service
public class HouseServiceImpl extends ServiceImpl<HouseMapper, House> implements HouseService {

    @Resource
    private HouseMapper houseMapper;

    @Override
    public IPage<HouseVo> selectList(HouseDto dto) {
        IPage<HouseVo> page = new Page<>(dto.getPageIndex(), dto.getPageSize());
        List<HouseVo> list = houseMapper.houseList(page,dto);
        page.setRecords(list);
        return page;
    }
}
